/**
 * @description All Routes Configuration
 */

import React from 'react'
import { BrowserRouter, browserHistory } from 'react-router-dom'
import { renderRoutes } from 'react-router-config'
import App from '@/components/App'
import { NotFoundPage } from '@/components/NotFoundPage'
import { login, register } from './login.register'
import operMgmtRoute from './operMgmt.module'
import userCenterRoute from './userCenter.module'
import systemRoute from './system.module'
import monitorAlarmRoute from './monitorAlarm.module'
import consoleModule from './console.module'

export const routes = [
  login,
  register,
  {
    path: '/',
    component: App,
    routes: [{ path: '/not-found', component: NotFoundPage }]
      .concat(operMgmtRoute)
      .concat(userCenterRoute)
      .concat(systemRoute)
      .concat(monitorAlarmRoute)
      .concat(consoleModule)
  }
]

export const RouterConfig = () => (
  <BrowserRouter history={browserHistory}>{renderRoutes(routes)}</BrowserRouter>
)
